﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SalePartial.IDAL;
using System.Data;
using System.Data.SqlClient;
using SalePartial.Model;

namespace SalePartial.BLL
{
    public class XPNotification : IXPNotification
    {
        private IXPNotification dal = SalePartial.DALFactory.DataAccess.CreateXPNotification();

        public XPNotificationInfo GetXPNotification(Guid id)
        {
            SqlDataReader reader = this.SelectReader(id);
            XPNotificationInfo info = null;
            if (reader.Read())
            {
                info = new XPNotificationInfo(reader);
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
            }
            return info;

        }

        public int Delete(Guid NotifyID)
        {
            return dal.Delete(NotifyID);
        }

        //<DataObjectMethod(DataObjectMethodType.Delete)> _
        public int DeleteByCreateUserID(Guid CreateUserID)
        {
            return dal.DeleteByCreateUserID(CreateUserID);
        }

        //<DataObjectMethod(DataObjectMethodType.Delete)> _
        public int DeleteByRecipientUserID(Guid RecipientUserID)
        {
            return dal.DeleteByRecipientUserID(RecipientUserID);
        }

        //<DataObjectMethod(DataObjectMethodType.Delete)> _
        public int DeleteDynamic(string v_whereCondition)
        {
            return dal.DeleteDynamic(v_whereCondition);
        }

        //<DataObjectMethod(DataObjectMethodType.Insert)> _
        public int Insert(XPNotificationInfo info)
        {
            return dal.Insert(info);
        }

        //<DataObjectMethod(DataObjectMethodType.Select)> _
        public DataSet SelectAll()
        {
            return dal.SelectAll();
        }

        //<DataObjectMethod(DataObjectMethodType.Select)> _
        public DataSet SelectByCreateUserID(Guid CreateUserID)
        {
            return dal.SelectByCreateUserID(CreateUserID);
        }

        //<DataObjectMethod(DataObjectMethodType.Select)> _
        public DataSet SelectByRecipientUserID(Guid RecipientUserID)
        {
            return dal.SelectByRecipientUserID(RecipientUserID);
        }

        //<DataObjectMethod(DataObjectMethodType.Fill)> _
        public DataSet SelectDynamic(string v_whereCondition, string v_orderByExpression)
        {
            return dal.SelectDynamic(v_whereCondition, v_orderByExpression);
        }

        //<DataObjectMethod(DataObjectMethodType.Fill)> _
        public DataSet SelectPaged()
        {
            return dal.SelectPaged();
        }

        //<DataObjectMethod(DataObjectMethodType.Select)> _
        public SqlDataReader SelectReader(Guid NotifyID)
        {
            return dal.SelectReader(NotifyID);
        }

        //<DataObjectMethod(DataObjectMethodType.Select)> _
        public SqlDataReader SelectReaderByCreateUserID(Guid CreateUserID)
        {
            return dal.SelectReaderByCreateUserID(CreateUserID);
        }

        //<DataObjectMethod(DataObjectMethodType.Select)> _
        public SqlDataReader SelectReaderByRecipientUserID(Guid RecipientUserID)
        {
            return dal.SelectReaderByRecipientUserID(RecipientUserID);
        }

        //<DataObjectMethod(DataObjectMethodType.Select)> _
        public DataSet SelectSingle(Guid NotifyID)
        {
            return dal.SelectSingle(NotifyID);
        }

        //<DataObjectMethod(DataObjectMethodType.Update)> _
        public int Update(XPNotificationInfo info)
        {
            return dal.Update(info);
        }
    }
}
